/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/threads
// Copyright (c) 2014.  All Rights Reserved
//
// File:		AEThread.h
// Author:		Gianluca Belardelli
// Date:		08/10/2013
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AETHREAD_H_
#define _AETHREAD_H_

class AE_COREDLLIMPEXP AEThread
{
// Members
protected:
	 AETHREADHANDLE	m_lpThread;
	AEUINT32				m_uiThreadID;

public:
#if defined( AE_PLATFORM_WIN32 )
	typedef AEUINT32 ( AESTDCALL *AEStartFunction )( void * );
#else
	typedef void *( AESTDCALL AEStartFunction )( void * );
#endif

	enum AEThreadStatus
	{
		AETHREAD_TERMINATED,
		AETHREAD_RUNNING,
		AETHREAD_NOT_STARTED
	};

// Methods
	AE_DECLARE_NON_COPYABLE( AEThread );

public:
	AE_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( TOBEDEFINED, AEThread );

	AEThread( void );
	~AEThread( void );

	AEINT32 StartThread( AEStartFunction *lpfnFunction, void *lpParam, const char *lpName, int nThreadStackSize = 0 );

	void JoinThread( void );

	AEThreadStatus GetStatus( void ) const;
	AETHREADHANDLE GetThreadHandle( void ) const;

	void SetProcessor( int nProcessor );
	int GetProcessor( void ) const;
	int GetStackSize( void ) const;
	/*bool SetPriority( AEThreadPriority tpPriority );
	AEThreadPriority GetPriority( void ) const;*/

};

#endif // _AETHREAD_H_
